﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace LDIFTestDataGenerator
{
    public partial class Form1 : Form
    {

        LDIFBuilder ldifBuilder = new LDIFBuilder();
        List<Attribute> attributes = new List<Attribute>();


        public Form1()
        {
            InitializeComponent();
            
        }

        private void AddAttBtn_Click(object sender, EventArgs e)
        {
            Attribute a = null;
            if (comboIn.Text == "Integer")
            {
                a = new GenericAttribute<int>();
                a.setName(inputOne.Text);
                a.setSize(int.Parse(size.Text));
            }
            else if (comboIn.Text == "String")
            {
                a = new GenericAttribute<string>();
                a.setName(inputOne.Text);
                a.setSize(int.Parse(size.Text));
            }
            else if (comboIn.Text == "Boolean")
            {
                a = new GenericAttribute<Boolean>();
                a.setName(inputOne.Text);
                a.setSize(int.Parse(size.Text));
            }

            attributes.Add(a);
            listbox.Items.Add(inputOne.Text + " : " + comboIn.Text);
            
        }

        private void GenButton_Click(object sender, EventArgs e)
        {
            int reps = int.Parse(numberOfRecords.Text);
            for (int i = 0; i < reps; i++)
            {
                File.AppendAllText(@"C:\Users\DevMachine\Documents\Visual Studio 2010\output.txt", ldifBuilder.GenerateAnLDIFEntry(attributes));
            }
            
        }


    }
}
